import FormItemTypeEnum from '@/model/enums/FormItemTypeEnum'
import RuleModel from './RuleModel'
export default class FormItemModel {
  /**
   * 定义索引类型为string
   */
  [index: string]: any
  /**
   * 字段名
   */
  public prop: string = ''
  /**
   * 表单类型，枚举类型
   */
  public type?: FormItemTypeEnum = FormItemTypeEnum.text
  /**
   * 字段标签，中文名
   */
  public label: string = ''
  /**
   * 校验规则
   */
  public rules?: Array<RuleModel> = []
  /**
   * 标签宽度
   */
  public labelWidth?: string = ''
  /**
   * 下拉框选项
   */
  public options?: Array<{ [key: string]: any }> = []
  /**
   * 提示
   */
  public placeholder?: string = ''

  public clearable?:boolean = false

  constructor(arg: FormItemModel) {
    for (let key of Object.keys(arg)) {
      this[key] = arg[key]
    }
  }
}
